home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14429 < prev    next >
Encoding:
Text File  |  1996-08-05  |  871 b   |  32 lines

  1. Newsgroups: comp.lang.c++
  2. Path: hkuxb.hku.hk!indigo6!cfwong
  3. From: cfwong@csd.hku.hk (Chingfung Wong)
  4. Subject: HELP: Template linking problem
  5. Message-ID: <Dp37nJ.Etx@hkuxb.hku.hk>
  6. Sender: usenet@hkuxb.hku.hk (USENET News System)
  7. Nntp-Posting-Host: indigo6.cs.hku.hk
  8. Organization: The University of Hong Kong
  9. X-Newsreader: TIN [version 1.1 PL8]
  10. Date: Sat, 30 Mar 1996 15:42:55 GMT
  11.  
  12. Hi
  13.  
  14. I have templates list, stack, heap in list.h, stack.h, and heap.h
  15. respectively. Files A.cc and B.cc uses these templates. It is fine
  16. when I compile A.o and B.o, but problem arise when I issue
  17. "g++ -o program program.c A.o B.o"
  18.  
  19. A.o(.text+0x1ed4): multiple defined reference to `SimpleList<Surface *>::N(void)'
  20. ....
  21. ..
  22.  
  23. I understand the template classes are instantiated in both A.o and B.o
  24. and caused the comfusion, but don't know how to handle it.
  25.  
  26. Would you help?
  27.  
  28. Thanks!
  29.  
  30. chingfung
  31.  
  32.